''' 调用JavaScript'''
from selenium import webdriver
from time import sleep

# 访问百度
driver = webdriver.Chrome()
driver.get('https://www.baidu.com')


# 搜索
driver.find_element_by_id('kw').send_keys('selenium')
driver.find_element_by_id('su').click()
sleep(2)

# 设置浏览器窗口大小
driver.set_window_size(500,500)

# 通过Javascript 设置浏览器窗口的滚动条位置
js = "window.scrollTo(100,450);"
driver.execute_script(js)
sleep(3)

driver.quit()